const app = getApp();
const mainList = [{
  tabTitle: '常用功能',
  list: [{
    icon: "/images/all_addOrdinary.png",
    width: 80,
    hegith: 80,
    title: '水卡开卡',
    url: '/pages/partner/cardApply/cardApply?from=1',
  }, {
    icon: "/images/all_recharge.png",
    width: 80,
    hegith: 80,
    title: '水卡充值',
    url: '/pages/partner/cardApply/cardApply?from=2',
  }, {
    icon: "/images/all_equipmentAdd.png",
    width: 80,
    hegith: 80,
    title: '添加设备',
    url: '/pages/partner/equipmentEdit/equipmentEdit?type=1',
  }, {
    icon: "/images/all_debugging.png",
    width: 80,
    hegith: 80,
    title: '设备调试',
    url: '/package/pages/debug/entrance/entrance',
  }, {
    icon: "/images/all_equipment.png",
    width: 80,
    hegith: 80,
    title: '设备',
    url: '/pages/partner/equipment/equipment',
  }, {
    icon: "/images/all_areaCode.png",
    width: 80,
    hegith: 80,
    title: '区域码',
    url: '/pages/partner/regionCode/list/list',
  }, {
    icon: "/images/all_park.png",
    width: 80,
    hegith: 80,
    title: '园区',
    url: '/pages/partner/community/community',
  }]
}, {
  tabTitle: '设备管理',
  list: [{
    icon: "/images/all_equipment.png",
    width: 80,
    hegith: 80,
    title: '设备',
    url: '/pages/partner/equipment/equipment',
  }, {
    icon: "/images/all_equipmentAdd.png",
    width: 80,
    hegith: 80,
    title: '添加设备',
    url: '/pages/partner/equipmentEdit/equipmentEdit?type=1',
  }, {
    icon: "/images/all_debugging.png",
    width: 80,
    hegith: 80,
    title: '设备调试',
    url: '/package/pages/debug/entrance/entrance',
  }, {
    icon: "/images/all_areaCode.png",
    width: 80,
    hegith: 80,
    title: '区域码',
    url: '/pages/partner/regionCode/list/list',
  }, {
    icon: "/images/all_mainboard.png",
    width: 80,
    hegith: 80,
    title: '主板库',
    url: '/pages/partner/libraryList/libraryList',
  }]
}, {
  tabTitle: '卡库管理',
  list: [{
    icon: "/images/all_kaku.png",
    width: 80,
    hegith: 80,
    title: '卡库',
    url: '/pages/partner/cardList/cardList',
  }, {
    icon: "/images/all_cardAdd.png",
    width: 80,
    hegith: 80,
    title: '水卡入库',
    url: '/pages/partner/cardList/cardAdd?type=0',
  }, {
    icon: "/images/all_cardAdd2.png",
    width: 80,
    hegith: 80,
    title: '水卡批量入库',
    url: '/pages/partner/cardList/cardAdd?type=1',
  }]
}, {
  tabTitle: '普通水卡',
  list: [{
    icon: "/images/all_ordinaryCard.png",
    width: 80,
    hegith: 80,
    title: '水卡',
    url: '/pages/partner/fictitiousCard/fictitiousCard?is_special=0',
  }, {
    icon: "/images/all_addOrdinary.png",
    width: 80,
    hegith: 80,
    title: '水卡开卡',
    url: '/pages/partner/cardApply/cardApply?from=1',
  }, {
    icon: "/images/all_recharge.png",
    width: 80,
    hegith: 80,
    title: '水卡充值',
    url: '/pages/partner/cardApply/cardApply?from=2',
  }, {
    icon: "/images/all_record.png",
    width: 80,
    hegith: 80,
    title: '充值记录',
    url: '/pages/partner/rechargeRecord/rechargeRecord',
  }, {
    icon: "/images/all_waterOrder_record.png",
    width: 80,
    hegith: 80,
    title: '开卡记录',
    url: '/pages/partner/applyList/applyList',
  }, {
    icon: "/images/all_apply.png",
    width: 80,
    hegith: 80,
    title: '申请记录',
    url: '/pages/partner/examineOnline/examineOnline',
  }, {
    icon: "/images/water-card-recycle.png",
    width: 80,
    hegith: 80,
    title: '水卡回收',
    url: '/pages/partner/waterCardRecycle/list'
  }, {
    icon: "/images/all_addOrdinary2.png",
    width: 80,
    hegith: 80,
    title: '批量开卡',
    url: '/pages/partner/cardList/cardAdd?type=2'
  }, {
    icon: "/images/all_rechargeable2.png",
    width: 80,
    hegith: 80,
    title: '批量充值',
    url: '/pages/partner/cardList/cardAdd?type=3'
  }]
}, {
  tabTitle: '特殊水卡',
  list: [{
    icon: "/images/all_specialCard.png",
    width: 80,
    hegith: 80,
    title: '水卡',
    url: '/pages/partner/fictitiousCard/fictitiousCard?is_special=1',
  }, {
    icon: "/images/all_addSpecialCard.png",
    width: 80,
    hegith: 80,
    title: '水卡开卡',
    url: '/pages/partner/specialApply/index?type=1',
  }, {
    icon: "/images/all_recharge.png",
    width: 80,
    hegith: 80,
    title: '水卡充值',
    url: '/pages/partner/specialApply/index?type=2',
  }, {
    icon: "/images/all_record.png",
    width: 80,
    hegith: 80,
    title: '充值记录',
    url: '/pages/partner/rechargeRecord/rechargeRecord?is_special=1',
  }, {
    icon: "/images/all_openSpecialRecord.png",
    width: 80,
    hegith: 80,
    title: '开卡记录',
    url: '/pages/partner/specialApplyList/specialApplyList',
  }, {
    icon: "/images/water-card-recycle.png",
    width: 80,
    hegith: 80,
    title: '水卡回收',
    url: '/pages/partner/waterCardRecycle/list'
  }]
}, {
  tabTitle: '经营管理',
  list: [{
    icon: "/images/all_rechargeable.png",
    width: 80,
    hegith: 80,
    title: '充值卡',
    url: '/package/pages/sellCard/list/list',
  }, {
    icon: "/images/all_salesPromotion.png",
    width: 80,
    hegith: 80,
    title: '促销活动',
    franchisee: true,
    url: '/pages/partner/promotion/index/index',
  }, {
    icon: "/images/all_setting.png",
    width: 80,
    hegith: 80,
    title: '设置管理',
    url: '/pages/partner/setManage/setManage',
  }, {
    icon: "/images/all_park.png",
    width: 80,
    hegith: 80,
    title: '园区',
    url: '/pages/partner/community/community',
  }, {
    icon: "/images/all_onlineMode.png",
    width: 80,
    hegith: 80,
    title: '价格模板',
    url: '/pages/partner/template/index?type=2',
  }, {
    icon: "/images/all_valet.png",
    width: 80,
    hegith: 80,
    title: '代客充值模板',
    url: '/pages/partner/template/index?type=3',
  }, {
    icon: "/images/all_redeemVoucher.png",
    width: 80,
    hegith: 80,
    title: '用户自助充值模板',
    url: '/pages/partner/template/index?type=1',
  }]
}, {
  tabTitle: '用户管理',
  list: [{
    icon: "/images/all_maintenance.png",
    width: 80,
    hegith: 80,
    title: '维修员',
    url: '/pages/partner/engineering/list/list?from=1',
  }, {
    icon: "/images/all_salesperson.png",
    width: 80,
    hegith: 80,
    title: '销售员',
    url: '/pages/partner/salesman/salesman',
  }, {
    icon: "/images/all_franchisee.png",
    width: 80,
    hegith: 80,
    title: '加盟商',
    franchisee: true,
    url: '/pages/partner/franchisee/franchisee',
  }, {
    icon: "/images/all_onlineUser.png",
    width: 80,
    hegith: 80,
    title: '线上用户',
    url: '/pages/partner/userManagement/userManagement',
  }]
}, {
  tabTitle: '资金管理',
  list: [{
    icon: "/images/all_achievement.png",
    width: 80,
    hegith: 80,
    title: '业绩',
    url: '/pages/partner/capitalmanage/capitalmanage',
  }, {
    icon: "/images/all_waterOrder.png",
    width: 80,
    hegith: 80,
    title: '打水订单',
    url: '/pages/partner/order/order',
  }, {
    icon: "/images/all_account.png",
    width: 80,
    hegith: 80,
    title: '账户',
    url: '/pages/partner/account/account',
  }]
}]
Page({


  /**
   * 页面的初始数据
   */
  data: {
    mainList,
    userInfo: ''
  },

  navUrl(e) {
    const {
      url,
      switchtab
    } = e.currentTarget.dataset;
    if (switchtab === true) {
      wx.switchTab({
        url
      })
    } else {
      wx.navigateTo({
        url
      })
    }

  },
  onShow() {
    this.getPartnerInfo()
  },

  //登录后获取用户信息
  getPartnerInfo() {
    var that = this;
    app.ajax({
      url: 'Partner/User/getPartnerInfo',
      data: {},
      success: function (res) {
        wx.stopPullDownRefresh();
        if (res.data.code == 200) {
          app.globalData.userInfo = res.data.data;
          //加盟商不显示促销活动和加盟商管理
          that.setData({
            userInfo: res.data.data,
            // hasUserInfo: true
          })
        }
      },
      error: e => {}
    })
  },







})